package com.rritw.webtools.action;

import javax.annotation.Resource;

import com.opensymphony.xwork2.ActionSupport;
import com.rritw.webtools.cache.CacheService;
import com.rritw.webtools.common.Const;

public abstract class IpsAction extends ActionSupport {

    private static final long serialVersionUID = -9089597260738889298L;

    @Resource
    protected CacheService    cacheService;

    /**
     * 网站的URL
     */
    private String            siteUrl;

    protected String          pageTitle;

    protected String          pageDescription;

    protected String          pageKeywords;

    protected int             code             = Const.HTTP_CODE_200;
    protected String          result;
    /**
     * 用户是否已经登陆
     */
    protected boolean         userLogin;
    /**
     * 登陆的用户ID
     */
    protected int             userId;
    /**
     * 管理员是否已经登陆
     */
    protected boolean         adminLogin;
    /**
     * 登陆的管理员ID
     */
    protected int             adminId;

    public String init() {
        this.siteUrl = cacheService.getSiteUrl();
        this.pageTitle = cacheService.getSiteName();
        this.pageDescription = cacheService.getSiteDesc();
        this.pageKeywords = cacheService.getSiteKeywords();

        return SUCCESS;
    }

    public int getCode() {
        return code;
    }

    public String getResult() {
        return result;
    }

    public String getSiteUrl() {
        return siteUrl;
    }

}
